from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_wtf import CSRFProtect
from flask_migrate import Migrate

#初始化flask插件
db = SQLAlchemy()
csrf = CSRFProtect()
migrate = Migrate()

def create_app():
    """
    创建app函数功能
    :return: app
    """
    app = Flask(__name__)
    app.config.from_object("settings.Dubug")
    #惰性加载插件
    db.init_app(app)
    csrf.init_app(app)
    migrate.init_app(app,db)
    #安装蓝图
    from FlaskPro.OAPrint import oaPro
    # app.register_blueprint("oaPro",url_prefix="oaPro")
    app.register_blueprint(oaPro)
    return app



